/*!
 * \file Preference.cc
 * \brief Déclaration des méthodes sur les préférences
 * \author LY Julie (Responsable)
 * \version 1.0
 * \date 22 février 2013
*/

#include "Preference.h"

#include <stdlib.h>
#include <iostream>
#include <string>

using namespace std ;


Preference::Preference(){
	this->mostPreferred = "None" ;
	this->lessPreferred = "None" ;
	this->condition = ""; 
	this->semantic = "Undefined";
}


Preference::Preference( string preference1, string preference2 ){
	this->mostPreferred = preference1 ;
	this->lessPreferred = preference2 ;
	this->condition = ""; 
	this->semantic = "Undefined";
}

Preference::Preference( string preference1, string preference2, string condition ){
	this->mostPreferred = preference1 ;
	this->lessPreferred = preference2 ;
	this->condition = condition; 
	this->semantic = "Undefined";
}


Preference::~Preference() {}

string Preference::getSemantic() const
{
    return semantic ;
}

void Preference::setSemantic( string semantic )
{
	if(semantic == "Strong" || semantic == "CeterisParibus" || semantic == "Optimist" || semantic == "Pessimist"){
		this->semantic = semantic ;
	}
	else{
		cout<<"Mauvaise semantique entrée en parametres"<<endl;
		exit(1);
	}
}

string Preference::getMostPreferred() const{
	return this->mostPreferred ;
}


string Preference::getLessPreferred() const{
	return this->lessPreferred ;
}


string Preference::getCondition() const{
	return this->condition ;
}


void Preference::setMostPreferred( string preference ) {
	this->mostPreferred = preference ;
}


void Preference::setLessPreferred( string preference ){
	this->lessPreferred = preference ;
}


void Preference::setAllPreferences( string preference1, string preference2 ){
	this->mostPreferred = preference1 ;
	this->lessPreferred = preference2 ;
}


void Preference::setAllPreferences( string preference1, string preference2, string condition ){
	this->mostPreferred = preference1 ;
	this->lessPreferred = preference2 ;
	this->condition = condition;
}


void Preference::show() const{
	cout<<"("<<getSemantic()<<") ";
	if(condition != "") cout<<"Given "<<condition<<", ";
	cout << "prefer " << this->mostPreferred << " to " << this->lessPreferred << endl ;
}

